load("@grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("//:build_variables.bzl", "COPTS")
load("//tools/lint:linters.bzl", "clang_tidy_test")

package(
    default_visibility = ["//:android_cuttlefish"],
)

proto_library(
    name = "screen_recording_server_proto",
    srcs = ["screen_recording.proto"],
    deps = ["@protobuf//:empty_proto"],
)

cc_proto_library(
    name = "screen_recording_server_cc_proto",
    deps = [":screen_recording_server_proto"],
)

cc_grpc_library(
    name = "libscreen_recording_server",
    srcs = [":screen_recording_server_proto"],
    grpc_only = True,
    deps = [
        ":screen_recording_server_cc_proto",
        "@grpc//:grpc++",
    ],
)

cc_binary(
    name = "screen_recording_server",
    srcs = [
        "main.cpp",
    ],
    copts = COPTS,
    deps = [
        ":libscreen_recording_server",
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/host/libs/command_util",
        "//cuttlefish/host/libs/command_util:libcuttlefish_run_cvd_proto",
        "//cuttlefish/host/libs/config:cuttlefish_config",
        "//cuttlefish/host/libs/config:logging",
        "@gflags",
        "@grpc",
        "@grpc//:grpc++",
        "@grpc//:grpc++_reflection",
        "@protobuf//:empty_cc_proto",
    ],
)

clang_tidy_test(
    name = "screen_recording_server_clang_tidy",
    srcs = [":screen_recording_server"],
    tags = [
        "clang-tidy",
        "clang_tidy",
    ],
)
